package kfs.light.screen;

import java.awt.image.BufferedImage;

public class Zone {
	private int x0;
	private int x1;
	private int y0;
	private int y1;

	private BufferedImage image;
	private Color color;

	public void updateImage(BufferedImage screen) {
		image = screen.getSubimage(x0, y0, x1 - x0, y1 - y0);

	}

	public void updateColor() {		
		color = new Color(image);
		color.start();
		
		
	}

	public Color getColor() throws InterruptedException {
		while(true)
			if(color.getState().equals(Thread.State.TERMINATED))
				return color;
		
	}

	public BufferedImage getImage() {
		return image;
	}

	public void setImage(BufferedImage image) {
		this.image = image;
	}

	public int getX0() {
		return x0;
	}

	public void setX0(int x0) {
		this.x0 = x0;
	}

	public int getX1() {
		return x1;
	}

	public void setX1(int x1) {
		this.x1 = x1;
	}

	public int getY0() {
		return y0;
	}

	public void setY0(int y0) {
		this.y0 = y0;
	}

	public int getY1() {
		return y1;
	}

	public void setY1(int y1) {
		this.y1 = y1;
	}

}
